# 多无人机种胡萝卜
clear()
size = get_world_size()
import common
drons = max_drones()
alldrons = []
if size % drons != 0 :
	size = size - (size % drons)
	set_world_size(size)
for n in range(drons):
	def plant_and_havest():
		while True:
			for i in range(size/drons):
				for y in range(size):
					x = n * size/drons +i 
					common.move_abs(x,y)
					if get_water() < 0.5:
						use_item(Items.Water)
					if get_ground_type() != Grounds.Soil:
						till()
					if can_harvest():
						harvest()
					plant(Entities.Carrot)
                    # 无人机不够覆盖全图时，可以换一列
					#move(North)
	d =  spawn_drone(plant_and_havest)
	if d :
		alldrons.append(d)
	else:
		plant_and_havest()